package com.zhiyou.serviceImpl;

import com.zhiyou.dao.HouseDao;

import com.zhiyou.daoImpl.HouseDaoImpl;

import com.zhiyou.model.House;
import com.zhiyou.service.HouseService;
import com.zhiyou.util.PageBean;

public class HouseServiceImpl implements HouseService {

	@Override
	public PageBean<House> show(int pc,int ps) {
		HouseDao hDao = new HouseDaoImpl();
		PageBean<House> pageBean = hDao.findAll(pc, ps);
		return pageBean;
	}

	@Override
	public House find(int id) {
		HouseDao hDao = new HouseDaoImpl();
		House house = hDao.findById(id);
		return house;
	}

	@Override
	public boolean delete(int id) {
		HouseDao hDao = new HouseDaoImpl();
		boolean flag = hDao.delete(id);
		return flag;
	}

	@Override
	public boolean update(Object[] obj) {
		HouseDao hDao = new HouseDaoImpl();
		boolean flag = hDao.update(obj);
		return flag;
	}

	@Override
	public boolean add(Object[] obj) {
		HouseDao hDao = new HouseDaoImpl();
		boolean flag = hDao.add(obj);
		return flag;

	}

	@Override
	public boolean dels(int[] id) {
		// TODO Auto-generated method stub
		HouseDao hDao = new HouseDaoImpl();
		int id1[] = hDao.dels(id);
		for(int i = 0;i<id1.length;i++){
			if(id1[i] == 0){
				return false;
			}
		}
		return true;
	}

	@Override
	public PageBean<House> find(String area, String isdouble, String direction,String status ,int pc, int ps) {
		// TODO Auto-generated method stub
		HouseDao hDao = new HouseDaoImpl();
		PageBean<House> pb = hDao.find(area, isdouble, direction, status, pc, ps);
		return pb;
	}
	
	
	
}
